# coding:utf-8
# @Time : 2021/4/28 20:59
# @File : manage.py
# --------------------------------------------
# 升级PIP版本 : pip install --upgrade pip
# 安装扩展清单 : pip install -r requirements.txt
# 生成扩展清单 : pip freeze > requirements.txt

import flask_script
from fifthplaymate import app

manager = flask_script.Manager(app)


def main():
    app.run()


def init_db():
    from app.models import db
    from app.application import app
    app.app_context().push()
    db.drop_all()
    db.create_all()
    from app.models.user import User
    from app.models.profile import Profile
    admin = User(username='admin', password='123456', nickname='管理名', is_admin=1)
    user = User(sex='女', username='13243909001', password='q12345', nickname='测试号', is_admin=0)
    profile = Profile(user_id='2', avatar='http://localhost:5000/file/avatar.png', phone='13243909001')
    db.session.add(admin)
    db.session.add(user)
    db.session.add(profile)
    db.session.commit()


if __name__ == '__main__':
    main()
